package org.atf.model.entity;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.PrePersist;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table
public class Audit implements Serializable{
	/**
	 * 
	 * 
	 */
	private static final long serialVersionUID = 1408473515126611377L;
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "AUDIT_ID")
	private Integer id;
	@Column( nullable = false,updatable = false)
	@Temporal(TemporalType.TIMESTAMP ) 
	private Date gentime; 
	
	private Integer serverId;
	private Integer profileId;
	private String username;
	private Date startTime;
	private Date endTime;
	private String task;
	private String comments;
	
	@PrePersist
	private void createdAt() {
		this.gentime=Calendar.getInstance().getTime();
	}
	public Audit(){
		super();
	}
	public Audit(String username, Integer serverId, String task, Date startTime, Date endTime, String comments){
		super();
		this.username= username;
		this.serverId=serverId;
		this.task= task;
		this.startTime=startTime;
		this.endTime= endTime;
		this.comments= comments;
		
	}
	
	public Audit(String username, Integer profileId, String task, String comments){
		super();
		this.username= username;
		this.profileId= profileId;
		this.task= task;
		this.comments= comments;
	
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public Integer getServerId() {
		return serverId;
	}
	public void setServerId(Integer serverId) {
		this.serverId = serverId;
	}
	public Integer getProfileId() {
		return profileId;
	}
	public void setProfileId(Integer profileId) {
		this.profileId = profileId;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public Date getStartTime() {
		return startTime;
	}
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	public Date getEndTime() {
		return endTime;
	}
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	public String getTask() {
		return task;
	}
	public void setTask(String task) {
		this.task = task;
	}
	public String getComments() {
		return comments;
	}
	public void setComments(String comments) {
		this.comments = comments;
	}
	public Date getGentime() {
		return gentime;
	}
	
}
